package com.abcdefg.springtrans.service;

import com.abcdefg.springtrans.mapper.LogInfoMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

@Slf4j
@Service
public class LogService {
    @Autowired
    private LogInfoMapper logInfoMapper;
//    @Transactional(propagation = Propagation.SUPPORTS)
@Transactional(propagation = Propagation.NEVER)
//@Transactional(propagation = Propagation.SUPPORTS)
//    @Transactional(propagation = Propagation.MANDATORY)
//@Transactional(propagation = Propagation.REQUIRES_NEW)
//    @Transactional(propagation = Propagation.NOT_SUPPORTED)
//@Transactional(propagation = Propagation.NESTED)
    public void insertLog(String name,String op){
        //记录⽤⼾操作
        logInfoMapper.insertLog(name,"⽤⼾注册");
        log.info("insertLog注册成功!");
//        int a=10/0;
    }
}
